// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// No Node.js APIs are available in this process because
// `nodeIntegration` is turned off. Use `preload.js` to
// selectively enable features needed in the rendering
// process.

document.addEventListener('DOMContentLoaded', () => {
  // 获取按钮元素
  const cacheBtn = document.getElementById('cache-btn');
  const minBtn = document.getElementById('min-btn');
  const maxBtn = document.getElementById('max-btn');
  const closeBtn = document.getElementById('close-btn');
  
  // 添加按钮事件监听
  if (cacheBtn) {
    cacheBtn.addEventListener('click', async () => {
      await window.electronAPI.clearCache();
    });
  }
  
  if (minBtn) {
    minBtn.addEventListener('click', () => {
      window.electronAPI.minimizeWindow();
    });
  }
  
  if (maxBtn) {
    maxBtn.addEventListener('click', () => {
      window.electronAPI.maximizeWindow();
    });
  }
  
  if (closeBtn) {
    closeBtn.addEventListener('click', () => {
      window.electronAPI.closeWindow();
    });
  }
});
